{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=2956
  Verdict: Accepted
}
uses SysUtils, Math;
 
var
	s:string;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
readln(s);
while length(s)<4 do s:='0'+s;
if (s[1]=s[4]) and (s[2]=s[3]) then write(1) else write(37);
end.